// utils/methodProvider.ts
import {inject, App} from 'vue';
import { DevMethods, devMethods } from './methods';

const DevMethodsKey = Symbol('DevMethodsKey');

export function devProvideMethods(app:App, methods: DevMethods = devMethods) {
    app.provide(DevMethodsKey, methods);
}

export function useDevMethods(): DevMethods {
    const methods = inject<DevMethods>(DevMethodsKey);
    if (!methods) {
        throw new Error('Methods have not been provided');
    }
    return methods;
}
